package com.econ.powercloud.ems.service.biz;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.econ.powercloud.clickhouse.dao.AnalogDataDAO;
import com.econ.powercloud.clickhouse.dao.StatusDataDAO;
import com.econ.powercloud.clickhouse.entity.AnalogData;
import com.econ.powercloud.clickhouse.entity.EmsWarnRecord;
import com.econ.powercloud.clickhouse.entity.StatusData;
import com.econ.powercloud.common.base.facade.enums.StatusType;
import com.econ.powercloud.common.base.facade.exception.CommonRuntimeException;
import com.econ.powercloud.common.base.facade.pojo.PageResult;
import com.econ.powercloud.common.base.facade.util.JacksonUtil;
import com.econ.powercloud.ems.common.enums.DeviceType;
import com.econ.powercloud.ems.common.enums.DitTypeEnum;
import com.econ.powercloud.ems.common.pojo.EmsWarnConfigDTO;
import com.econ.powercloud.ems.common.pojo.EmsWarnStatDTO;
import com.econ.powercloud.ems.config.InitParameter;
import com.econ.powercloud.ems.constant.SysConstant;
import com.econ.powercloud.ems.dal.entity.*;
import com.econ.powercloud.ems.pojo.*;
import com.econ.powercloud.ems.pojo.requestVO.EmsWarnPidEditVO;
import com.econ.powercloud.ems.pojo.requestVO.EmsWarnPidRequestVO;
import com.econ.powercloud.ems.service.dao.*;
import com.econ.powercloud.ems.service.dao.clickhouse.EmsWarnRecordDAO;
import com.econ.powercloud.ems.util.PageUtil;
import com.econ.powercloud.ems.util.WarnCacheKeyUtils;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;

import java.util.*;
import java.util.stream.Collectors;

/**
 * @Author : zjf
 * @Description : 诊断预警service
 * @Date : 2022/12/2 11:32
 * @Modified by : zjf
 */
@Service
public class EmsWarnService {

    public static final Integer MAX_WARN_PID_NUM = 5;

    @Autowired
    private EmsWarnConfigDAO emsWarnConfigDAO;
    @Autowired
    private EmsWarnStatisticalDAO emsWarnStatisticalDAO;
    @Autowired
    private EmsDeviceDAO emsDeviceDAO;
    @Autowired
    private AnalogDataDAO analogDataDAO;
    @Autowired
    private StatusDataDAO statusDataDAO;
    @Autowired
    private EmsWarnRecordDAO emsWarnRecordDAO;
    @Autowired
    private StringRedisTemplate stringRedisTemplate;
    @Autowired
    private IotProductYcDAO iotProductYcDAO;
    @Autowired
    private IotProductYxDAO iotProductYxDAO;
    @Autowired
    private ExtIotDeviceCalculationDAO extIotDeviceCalculationDAO;
    @Autowired
    private InitParameter initParameter;

    /**
     * 获取诊断预警列表
     * @param deviceCode
     * @param isAsc
     * @param sortField
     * @param pageNo
     * @param pageSize
     * @return
     */
    public PageResult<List<EmsWarnStatisticalVO>> getWarnStatisticalData(String deviceCode,boolean isAsc,Integer sortField,
                                                                         Integer pageNo,Integer pageSize){
        Page<EmsWarnStatistical> page = emsWarnStatisticalDAO.selectPageByDeviceCode(deviceCode, isAsc, sortField, pageNo, pageSize);
        if(CollectionUtils.isEmpty(page.getRecords())){
            return PageResult.<List<EmsWarnStatisticalVO>>builder().pageNo(pageNo).totalCount(0).data(Collections.emptyList()).build();
        }
        List<EmsWarnStatisticalVO> statisticalVOList = JacksonUtil.convertToList(page.getRecords(),EmsWarnStatisticalVO.class);
        this.statisticalVOList(statisticalVOList);
        return PageResult.<List<EmsWarnStatisticalVO>>builder().pageNo(pageNo).totalCount((int)page.getTotal()).data(statisticalVOList).build();
    }

    /**
     * 预警点号历史数据
     * @param deviceCode
     * @param startTime
     * @param endTime
     * @return
     */
    public List<EmsWarnHisChartDataVO> getWarnPidHisData(String deviceCode, Long startTime, Long endTime){
        List<EmsWarnConfig> configList = emsWarnConfigDAO.selectListByDeviceCode(deviceCode);
        if(CollectionUtils.isEmpty(configList)){
            return Collections.emptyList();
        }
        List<EmsWarnHisChartDataVO> resultList = Lists.newArrayList();
        List<String> ycPids = configList.stream().filter(e-> e.getDitType().equals(DitTypeEnum.YC.getCode()) || e.getDitType().equals(DitTypeEnum.CAL_YC.getCode())).map(EmsWarnConfig::getPid).collect(Collectors.toList());
        List<String> yxPids = configList.stream().filter(e-> e.getDitType().equals(DitTypeEnum.YX.getCode()) || e.getDitType().equals(DitTypeEnum.CAL_YX.getCode())).map(EmsWarnConfig::getPid).collect(Collectors.toList());
        //不同类别分别查询数据
        Map<String, List<AnalogData>> ycDataMap= Maps.newHashMap();
        Map<String, List<StatusData>> yxDataMap= Maps.newHashMap();
        if(!CollectionUtils.isEmpty(ycPids)){
            ycDataMap = analogDataDAO.selectByPidsAndTime(ycPids,true, startTime, endTime)
                    .stream().collect(Collectors.groupingBy(d->d.getPid(), LinkedHashMap::new,Collectors.toList()));
        }
        if(!CollectionUtils.isEmpty(yxPids)){
            yxDataMap = statusDataDAO.selectByPidsAndTime(yxPids,true, startTime, endTime)
                    .stream().collect(Collectors.groupingBy(d->d.getPid(), LinkedHashMap::new,Collectors.toList()));
        }
        for (EmsWarnConfig config : configList){
            List<ChartDataVO> chartDataVOList = Lists.newArrayList();
            if (config.getDitType().equals(DitTypeEnum.YC.getCode()) || config.getDitType().equals(DitTypeEnum.CAL_YC.getCode())) {
                //遥测或者计算遥测
                List<AnalogData> analogDatas = ycDataMap.get(config.getPid());
                if(org.apache.commons.collections.CollectionUtils.isNotEmpty(analogDatas)){
                    analogDatas.forEach(a -> {
                        chartDataVOList.add(ChartDataVO.builder().time(a.getT()).val(a.getV()).build());
                    });
                }
            } else if (config.getDitType().equals(DitTypeEnum.YX.getCode()) || config.getDitType().equals(DitTypeEnum.CAL_YX.getCode())) {
                //遥信或者计算遥信
                List<StatusData> statusDatas = yxDataMap.get(config.getPid());
                if(org.apache.commons.collections.CollectionUtils.isNotEmpty(statusDatas)){
                    statusDatas.forEach(a -> {
                        chartDataVOList.add(ChartDataVO.builder().time(a.getT()).val(a.getV()).build());
                    });
                }
            }
            EmsWarnHisChartDataVO dataVO = EmsWarnHisChartDataVO.builder()
                    .id(config.getId()).warnUpper(config.getWarnUpper()).warnLower(config.getWarnLower())
                    .deviceCode(deviceCode).pidName(config.getPidName())
                    .ditType(config.getDitType()).pid(config.getPid()).datas(chartDataVOList).build();
            resultList.add(dataVO);
        }
        return resultList;
    }

    /**
     * 查询单个预警点号
     * @param id
     * @return
     */
    public EmsWarnConfigVO selectWarnPidById(Integer id){
        EmsWarnConfig emsWarnConfig = emsWarnConfigDAO.getById(id);
        Assert.notNull(emsWarnConfig,"该预警点号不存在!");
        EmsWarnConfigVO configVO = JacksonUtil.convertToObj(emsWarnConfig,EmsWarnConfigVO.class);
        configVO.setDitTypeName(DitTypeEnum.getDescFromCode(configVO.getDitType()));
        return configVO;
    }

    /**
     * 新增预警点号
     * @param requestVO
     */
    @Transactional(rollbackFor = Exception.class)
    public void addWarnPid(EmsWarnPidRequestVO requestVO){
        EmsDevice emsDevice = emsDeviceDAO.selectByDeviceCode(requestVO.getDeviceCode());
        Assert.notNull(emsDevice,"设备不存在!");
        //校验新增预警点号
        this.checkWarnPid(requestVO,null);
        EmsWarnConfig config = JacksonUtil.convertToObj(requestVO,EmsWarnConfig.class);
        config.setPid(emsDevice.getInitDeviceCode() + SysConstant.SPOT + requestVO.getDit());
        config.setPidName(this.getDitName(emsDevice,requestVO.getDitType(),requestVO.getDit()));
        config.setGmtCreate(System.currentTimeMillis());
        config.setGmtModify(System.currentTimeMillis());
        emsWarnConfigDAO.save(config);
        //更新该设备统计数据
        EmsWarnStatistical warnStatistical = emsWarnStatisticalDAO.selectOneByDeviceCode(requestVO.getDeviceCode());
        warnStatistical.setWarnTotalPidNum(warnStatistical.getWarnTotalPidNum() + 1);
        warnStatistical.setGmtModify(System.currentTimeMillis());
        emsWarnStatisticalDAO.updateById(warnStatistical);
        initParameter.initWarnConfigList();
        //更新redis预警配置缓存
        this.updateRedisWarnConfig(requestVO.getDeviceCode());
    }

    @Transactional(rollbackFor = Exception.class)
    public void modifyWarnPid(EmsWarnPidEditVO editVO){
        EmsDevice emsDevice = emsDeviceDAO.selectByDeviceCode(editVO.getDeviceCode());
        Assert.notNull(emsDevice,"设备不存在!");
        EmsWarnConfig emsWarnConfig = emsWarnConfigDAO.getById(editVO.getId());
        Assert.notNull(emsWarnConfig,"该预警点号不存在!");
        EmsWarnConfig config = JacksonUtil.convertToObj(editVO,EmsWarnConfig.class);
        config.setPid(emsDevice.getInitDeviceCode() + SysConstant.SPOT + editVO.getDit());
        config.setPidName(this.getDitName(emsDevice,editVO.getDitType(),editVO.getDit()));
        config.setGmtModify(System.currentTimeMillis());
        emsWarnConfigDAO.updateById(config);
        //校验修改预警点号
        this.checkWarnPid(editVO,editVO.getId());
        if(!Objects.equals(emsWarnConfig.getPid(),config.getPid())){
            //更新redis预警统计数据缓存
            Integer todayPidNum = this.deleteWarnStatByWarnPid(editVO.getDeviceCode(),emsWarnConfig.getPid());
            //更新该设备统计数据
            EmsWarnStatistical warnStatistical = emsWarnStatisticalDAO.selectOneByDeviceCode(editVO.getDeviceCode());
            warnStatistical.setWarnTodayPidNum(todayPidNum);
            warnStatistical.setGmtModify(System.currentTimeMillis());
            emsWarnStatisticalDAO.updateById(warnStatistical);
        }
        initParameter.initWarnConfigList();
        //更新redis预警配置缓存
        this.updateRedisWarnConfig(editVO.getDeviceCode());
    }

    @Transactional(rollbackFor = Exception.class)
    public void deleteWarnPid(Integer id){
        EmsWarnConfig emsWarnConfig = emsWarnConfigDAO.getById(id);
        Assert.notNull(emsWarnConfig,"该预警点号不存在!");
        emsWarnConfigDAO.removeById(id);
        //更新redis预警统计数据缓存
        Integer todayPidNum = this.deleteWarnStatByWarnPid(emsWarnConfig.getDeviceCode(),emsWarnConfig.getPid());
        //更新该设备统计数据
        EmsWarnStatistical warnStatistical = emsWarnStatisticalDAO.selectOneByDeviceCode(emsWarnConfig.getDeviceCode());
        warnStatistical.setWarnTodayPidNum(todayPidNum);
        warnStatistical.setWarnTotalPidNum(warnStatistical.getWarnTotalPidNum() - 1);
        warnStatistical.setGmtModify(System.currentTimeMillis());
        emsWarnStatisticalDAO.updateById(warnStatistical);
        initParameter.initWarnConfigList();
        //更新redis预警配置缓存
        this.updateRedisWarnConfig(emsWarnConfig.getDeviceCode());
    }

    /**
     * 获取预警记录
     * @param ditName
     * @param startTime
     * @param endTime
     * @param pageNo
     * @param pageSize
     * @return
     */
    public PageResult<List<EmsWarnRecordVO>> selectWarnRecord(String deviceCode,String ditName,Long startTime,Long endTime,Integer pageNo,Integer pageSize){
        List<EmsWarnConfig> configList = emsWarnConfigDAO.getBaseMapper().selectListByDeviceCodeAndPidName(deviceCode,ditName);
        if(CollectionUtils.isEmpty(configList)){
            return PageResult.<List<EmsWarnRecordVO>>builder().pageNo(pageNo).totalCount(0).data(Collections.emptyList()).build();
        }
        List<String> pids = configList.stream().map(EmsWarnConfig::getPid).collect(Collectors.toList());
        List<EmsWarnRecord> warnRecordList = emsWarnRecordDAO.selectByPidsAndTime(pids,false,startTime,endTime);
        if(CollectionUtils.isEmpty(warnRecordList)){
            return PageResult.<List<EmsWarnRecordVO>>builder().totalCount(0).pageNo(pageNo).data(Collections.emptyList()).build();
        }
        Map<String,String> pidMap = configList.stream().collect(Collectors.toMap(EmsWarnConfig::getPid,EmsWarnConfig::getPidName,(val1, val2) -> val2));
        List<EmsWarnRecordVO> emsWarnRecordVOList = JacksonUtil.convertToList(warnRecordList,EmsWarnRecordVO.class);
        emsWarnRecordVOList.stream().forEach(d-> {
            d.setPidName(pidMap.get(d.getPid()));
            if(d.getRecoveryTime() <= d.getWarnTime()){
                d.setRecoveryTime(null);
            }
        });
        return PageResult.<List<EmsWarnRecordVO>>builder().totalCount(emsWarnRecordVOList.size()).pageNo(pageNo)
                .data(PageUtil.getPageSizeDataForRelations(emsWarnRecordVOList,pageNo,pageSize)).build();
    }

    /**
     * 初始化预警统计表
     */
    @Transactional(rollbackFor = Exception.class)
    public void initWarnStatisticalData(List<InitWarnStatisticalRequestVO> requestVOList){
        Integer sort = 1;
        List<EmsWarnStatistical> statisticalList = Lists.newArrayList();
        List<EmsWarnConfig> warnConfigList = Lists.newArrayList();
        List<EmsDevice> emsDeviceList = emsDeviceDAO.list();
        List<EmsDevice> otherDeviceList = emsDeviceList.stream().filter(d-> !Objects.equals(d.getDeviceType(), DeviceType.CLUSTER.getCode())).collect(Collectors.toList());
        List<EmsDevice> clusterDeviceList = emsDeviceList.stream().filter(d-> Objects.equals(d.getDeviceType(), DeviceType.CLUSTER.getCode())).collect(Collectors.toList());
        if(!CollectionUtils.isEmpty(otherDeviceList)){
            for (EmsDevice d : otherDeviceList){
                statisticalList.add(EmsWarnStatistical.builder()
                        .deviceCode(d.getDeviceCode()).warnTotalNum(0).warnTodayPidNum(0).warnTotalPidNum(0).warnTodayNum(0).sort(sort)
                        .gmtCreate(System.currentTimeMillis()).gmtModify(System.currentTimeMillis())
                        .build());
                sort++;
            }
        }
        if(!CollectionUtils.isEmpty(clusterDeviceList)){
            for (EmsDevice d : clusterDeviceList){
                Integer warnTotalPidNum = CollectionUtils.isEmpty(requestVOList)?0:requestVOList.size();
                statisticalList.add(EmsWarnStatistical.builder()
                        .deviceCode(d.getDeviceCode()).warnTotalNum(0).warnTodayPidNum(0).warnTotalPidNum(warnTotalPidNum).warnTodayNum(0).sort(sort)
                        .gmtCreate(System.currentTimeMillis()).gmtModify(System.currentTimeMillis())
                        .build());
                sort++;
                if(!CollectionUtils.isEmpty(requestVOList)){
                    requestVOList.stream().forEach(requestVO ->{
                        warnConfigList.add(EmsWarnConfig.builder()
                                .deviceCode(d.getDeviceCode()).ditType(requestVO.getDitType()).dit(d.getModuleCode() + "." + requestVO.getDitSuffix())
                                .pid(d.getInitDeviceCode() + "." + d.getModuleCode() + "." + requestVO.getDitSuffix()).pidName(requestVO.getPidName())
                                .warnUpper(requestVO.getWarnUpper()).warnLower(requestVO.getWarnLower())
                                .gmtCreate(System.currentTimeMillis()).gmtModify(System.currentTimeMillis())
                                .build());
                    });
                }
            }
        }
        emsWarnStatisticalDAO.remove(Wrappers.lambdaQuery());
        if(!CollectionUtils.isEmpty(statisticalList)){
            emsWarnStatisticalDAO.saveBatch(statisticalList);
        }
        emsWarnConfigDAO.remove(Wrappers.lambdaQuery());
        if(!CollectionUtils.isEmpty(warnConfigList)){
            emsWarnConfigDAO.saveBatch(warnConfigList);
        }
        initParameter.initWarnConfigList();
        //初始化redis的数据
        this.initWarnRedisData();
    }

    /**
     * 根据dit获取点号名称
     */
    private String getDitName(EmsDevice emsDevice,Integer ditType,String dit){
        if(Objects.equals(ditType,DitTypeEnum.YC.getCode())){
            //查询产品遥测表
            IotProductYc iotProductYc = iotProductYcDAO.selectYcByDit(dit,emsDevice.getProductKey());
            return iotProductYc == null?null:iotProductYc.getName();
        }else if(Objects.equals(ditType,DitTypeEnum.YX.getCode())){
            //查询产品遥信表
            IotProductYx iotProductYx = iotProductYxDAO.selectYxByDit(dit,emsDevice.getProductKey());
            return iotProductYx == null?null:iotProductYx.getName();
        }else if(Objects.equals(ditType,DitTypeEnum.CAL_YC.getCode()) || Objects.equals(ditType,DitTypeEnum.CAL_YX.getCode())){
            //查询计算点号表
            ExtIotDeviceCalculation calculation = extIotDeviceCalculationDAO.selectByComputeCode(String.format("%s.%s",emsDevice.getInitDeviceCode(),dit));
            return calculation == null?null:calculation.getComputeName();
        }
        return null;
    }

    /**
     * 需要修改/新增的预警点号
     * @param requestVO
     * @param id
     * @param <T>
     * @return 返回该设备的预警点号总个数(如果是新增则需要总个数+1)
     */
    private <T extends EmsWarnPidRequestVO> void checkWarnPid(T requestVO, Integer id){
        if(requestVO.getWarnLower() == null && requestVO.getWarnUpper() == null){
            throw new CommonRuntimeException(StatusType.FAIL,"预警上限和预警下限最少填写一个!");
        }
        if(requestVO.getWarnUpper() !=null && requestVO.getWarnLower() != null){
            Assert.isTrue(requestVO.getWarnUpper() > requestVO.getWarnLower(),"预警上限要大于预警下限!");
        }
        List<EmsWarnConfig> configList = emsWarnConfigDAO.selectListByDeviceCode(requestVO.getDeviceCode());
        if(CollectionUtils.isEmpty(configList)){
            return ;
        }
        //新增时需要判断当前已保存的点号的个数
        if(id == null){
            Assert.isTrue(configList.size() < MAX_WARN_PID_NUM,"预警点号最多保存5个!");
        }else {
            configList = configList.stream().filter(d-> !Objects.equals(d.getId(),id)).collect(Collectors.toList());
        }
        //判断点号是否重复
        List<String> ditList = configList.stream().map(d-> d.getDit() + SysConstant.SPOT + d.getDitType()).collect(Collectors.toList());
        Assert.isTrue(!ditList.contains(requestVO.getDit() + SysConstant.SPOT + requestVO.getDitType()),"该预警点号已存在!");
    }

    private void statisticalVOList(List<EmsWarnStatisticalVO> statisticalVOList){
        if(CollectionUtils.isEmpty(statisticalVOList)){
            return;
        }
        List<String> deviceCodeList = statisticalVOList.stream().map(EmsWarnStatisticalVO::getDeviceCode).collect(Collectors.toList());
        Map<String,String> deviceCodeMap = emsDeviceDAO.selectByDeviceCodes(deviceCodeList).stream().collect(Collectors.toMap(EmsDevice::getDeviceCode,EmsDevice::getDeviceName));
        statisticalVOList.stream().forEach(d-> d.setDeviceName(deviceCodeMap.get(d.getDeviceCode())));
    }

    /**
     * 根据设备更新设备诊断预警点号
     * @param deviceCode
     */
    private void updateRedisWarnConfig(String deviceCode){
        List<EmsWarnConfig> configList = emsWarnConfigDAO.selectListByDeviceCode(deviceCode);
        String hashKey = WarnCacheKeyUtils.getWarnConfigKey(deviceCode);
        //删除以前的数据
        stringRedisTemplate.delete(hashKey);
        //更新最新的数据
        if(CollectionUtils.isEmpty(configList)){
            return;
        }
        Map<String,String> hashMap = Maps.newHashMap();
        configList.stream().forEach(d->{
            EmsWarnConfigDTO configDTO = JacksonUtil.convertToObj(d,EmsWarnConfigDTO.class);
            hashMap.put(d.getPid() + SysConstant.CABLE + d.getDitType(),JacksonUtil.toJSONString(configDTO));
        });
        stringRedisTemplate.opsForHash().putAll(hashKey,hashMap);
    }

    /**
     * 删除预警redis中的统计数据缓存
     * @return 今日预警点号个数
     */
    private Integer deleteWarnStatByWarnPid(String deviceCode,String pid){
        String key = WarnCacheKeyUtils.getWarnStatKey();
        String warnStatVal = (String)stringRedisTemplate.opsForHash().get(key,deviceCode);
        if(warnStatVal == null){
            return 0;
        }
        EmsWarnStatDTO emsWarnStatDTO = JacksonUtil.parseObject(warnStatVal,EmsWarnStatDTO.class);
        if(CollectionUtils.isEmpty(emsWarnStatDTO.getPids())){
            return 0;
        }
        emsWarnStatDTO.getPids().remove(pid);
        Integer todayWarnPidNum = emsWarnStatDTO.getPids().size();
        stringRedisTemplate.opsForHash().put(key,deviceCode,JacksonUtil.toJSONString(emsWarnStatDTO));
        return todayWarnPidNum;
    }

    /**
     * 初始化预警redis中的数据(配置与统计数据)
     */
    private void initWarnRedisData(){
        List<EmsWarnStatistical> statisticalList = emsWarnStatisticalDAO.list();
        List<EmsWarnConfig> warnConfigList = emsWarnConfigDAO.list();
        //预警统计redis更新
        String statKey = WarnCacheKeyUtils.getWarnStatKey();
        Map<String,String> statDTOMap = Maps.newHashMap();
        statisticalList.stream().forEach(d->{
            statDTOMap.put(d.getDeviceCode(),JacksonUtil.toJSONString(EmsWarnStatDTO.builder()
                    .id(d.getId()).deviceCode(d.getDeviceCode()).warnTotalNum(d.getWarnTotalNum()).warnTodayNum(d.getWarnTodayNum())
                    .pids(Collections.emptySet()).build()));
        });
        stringRedisTemplate.opsForHash().putAll(statKey,statDTOMap);
        //预警配置redis更新
        if(CollectionUtils.isEmpty(warnConfigList)){
            return;
        }
        Map<String,List<EmsWarnConfig>> warnConfigMap = warnConfigList.stream().collect(Collectors.groupingBy(d->d.getDeviceCode()));
        warnConfigMap.forEach((deviceCode,configList)->{
            String hashKey = WarnCacheKeyUtils.getWarnConfigKey(deviceCode);
            Map<String,String> hashMap = Maps.newHashMap();
            configList.stream().forEach(d->{
                EmsWarnConfigDTO configDTO = JacksonUtil.convertToObj(d,EmsWarnConfigDTO.class);
                hashMap.put(d.getPid() + SysConstant.CABLE + d.getDitType(),JacksonUtil.toJSONString(configDTO));
            });
            stringRedisTemplate.opsForHash().putAll(hashKey,hashMap);
        });
    }

}
